from machine import Pin
# 要拉高，不然模组的上电时序比GPS早，如果低电平，GPS起不来。没有语句输出
Pin(Pin.GPIO2, Pin.OUT, Pin.PULL_DISABLE, 1)


import pm
# 使能低功耗
pm.autosleep(1)


from usr.qframe import Application
from usr.extensions import (
    net_service,
    gsensor_service,
    job_service,
    mqtt_client_agent
)


def create_app(name='demo', version='1.0.0', config_path='/usr/default.json'):
    _app = Application(name, version=version)
    _app.config.init(config_path)

    net_service.init_app(_app)
    gsensor_service.init_app(_app)
    job_service.init_app(_app)
    mqtt_client_agent.init_app(_app)

    return _app


if __name__ == '__main__':
    app = create_app()
    app.run()
